<?php
namespace App\Http\Controller;
use EApiSwoole\Support\Facades\DB;
use EApiSwoole\Support\Facades\Redis;
use Swoole\Runtime;
use Swoole\Coroutine;
use Swoole\Coroutine\Channel;
class IndexController
{
    public function index()
    {
       
       return '我是首页地址';
    }
//测试性能
 public function test()
    {
		 $chan = new Channel(1);
		 Coroutine::create(function ()  use ($chan) {
			 $limit=mt_rand(1,1000000);
		            $res=DB::query("select * from user where id={$limit} ");
					$res=json_encode($res);
					 $chan->push($res);
		  });
		  return $chan->pop();
    }
}
